#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

int diagonalSum(int** mat, int matSize, int* matColSize)
{
    int sum = 0;

    for (int j = 0; j < matSize; j++)
    {
        sum = sum + mat[j][j];
    }
    for (int j = 0; j < matSize; j++)
    {
        sum = sum + mat[j][matColSize[j] - 1 - j];
    }
    if (matSize % 2 == 1)
    {
        sum = sum - mat[matSize / 2][matSize / 2];
    }
    return sum;
}